package com.tgu.home_action.dao;

import com.tgu.home_action.pojo.Client;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ClientMapper {
    /**
     * 查询符合条件的第三方应用数量
     */
    int getAccordClientsNum(Client client);

    /**
     * 查询符合条件的第三方应用
     */
    List<Client> getAccordClients(Client client);

    /**
     * 插入第三方应用
     */
    void insertClient(Client client);

    /**
     * 更新第三方应用
     */
    void updateClient(Client client);

    /**
     * 通过id查询
     */
    @Select("select * from clients where id=#{id}")
    Client getById(Integer id);

    @Delete("delete from clients where id=#{clientId}")
    Boolean deleteClient(Integer clientId);

    /**
     * 通过appId查询
     */
    @Select("select * from clients where app_id=#{appId}")
    Client getByAppId(String appId);
}
